﻿using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WH.Common.DbConfig.Model
{
    [SugarTable("sys_configs")]
    public class AppConfigEntity
    {
        [SugarColumn(ColumnName = "id", IsPrimaryKey = true, Length = 50, ColumnDescription = "id")]
        public string Id { get; set; } = null!;

        [SugarColumn(ColumnName = "key", IsNullable = false, Length = 50, ColumnDescription = "配置名称")]
        public string Key { get; set; } = null!;

        [SugarColumn(ColumnName = "value", IsNullable = true, Length = 255, ColumnDescription = "配置值")]
        public string? Value { get; set; }

        [SugarColumn(ColumnName = "description", IsNullable = false, Length = 50, ColumnDescription = "描述")]
        public string Description { get; set; } = null!;

        [SugarColumn(ColumnName = "config_category", IsNullable = true, Length = 50, ColumnDescription = "配置类别")]
        public string? ConfigCategory { get; set; }

        [SugarColumn(ColumnName = "data_type", IsNullable = true, Length = 50, ColumnDescription = "数据类型")]
        public int? DataType { get; set; }

        [SugarColumn(ColumnName = "component_type", IsNullable = true, Length = 50, ColumnDescription = "组件类型")]
        public string? ComponentType { get; set; }

        [SugarColumn(ColumnName = "component_default_value", IsNullable = true, Length = 50, ColumnDescription = "组件默认值")]
        public string? ComponentDefaultValue { get; set; }

        [SugarColumn(ColumnName = "index", IsNullable = true, ColumnDescription = "层级")]
        public int Index { get; set; }

        [SugarColumn(ColumnName = "parent_id", IsNullable = false, Length = 50, ColumnDescription = "父级id")]
        public string ParentId { get; set; } = null!;

        //[SugarColumn(IsIgnore = true)]
        //public List<AppConfigEntity>? Children { get; set; }

        //[SugarColumn(IsIgnore = true)]
        //public string Link { get; set; } = null!;

        /// <summary>
        /// 排序
        /// </summary>
        [SugarColumn(ColumnName = "sort_no", IsNullable = true, ColumnDescription = "排序")]
        public int SortNo { get; set; }

        /// <summary>
        /// 注释
        /// </summary>
        [SugarColumn(ColumnName = "summary", IsNullable = true, ColumnDescription = "排序")]
        public string? Summary { get; set; }

        /// <summary>
        /// 是否启用
        /// </summary>
        [SugarColumn(ColumnName = "is_enable", ColumnDescription = "是否启用")]
        public bool IsEnable { get; set; }
    }
}
